

#ifndef ORGANIZATIONDAO_INTERFACE_H
#define ORGANIZATIONDAO_INTERFACE_H

#include <stdint.h>
#include <string>
#include "app_platform/cntl_info.h"

#include <set>	
#include <map>	
#include <vector>	
#include "erp/organization/ddo/branchddo_organization.h"	
#include "erp/organization/ddo/organizationfilterddo_organization.h"	


namespace erp
{
namespace organization
{
namespace dao
{

	/// 同步调用接口
	class IOrganizationDao	{
	public:
		virtual ~IOrganizationDao() {}

	public:

		/**
		 *
	 	 * 删除分支机构（逻辑）
		 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param Set branchId: 需删除的分支机构的ID，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param Map errorCode: 删除失败的错误码 		
		 *@param Map errorMsg: 删除失败的错误信息 		
		 *@param String outReserve: 返回保留字   		
		 *
		 *@return  uint32_t : 0(成功) 其它失败
 	     *
		 */
	    virtual uint32_t DeleteBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
	    	) = 0;

		/**
		 *
	 	 * 根据过滤条件查询支机构列表信息
		 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param OrganizationFilterDdo filter: 过滤器，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param uint32_t total: 分支机构总数 		
		 *@param Vector branch: 分支机构列表信息 		
		 *@param String outReserve: 返回保留字   		
		 *
		 *@return  uint32_t : 0(成功) 其它失败
 	     *
		 */
	    virtual uint32_t FindBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::COrganizationFilterDdo& filter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	    	) = 0;

		/**
		 *
	 	 * 根据分支机构ID批量获取分支机构信息
		 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param Set branchId: 需获取的分支机构的ID，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param Map errorCode: 获取失败的错误码 		
		 *@param Map errorMsg: 获取失败的错误信息 		
		 *@param Map branch: 获取成功的分支机构信息 		
		 *@param String outReserve: 返回保留字   		
		 *
		 *@return  uint32_t : 0(成功) 其它失败
 	     *
		 */
	    virtual uint32_t GetBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
	    	) = 0;

		/**
		 *
	 	 * 添加/修改分支机构；传入分支机构ID不为0时则进行修改，反之则进行添加；不能进行逻辑删除
		 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param BranchDdo branch: 分支机构PO，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param String outReserve: 返回保留字   		
		 *
		 *@return  uint32_t : 0(成功) 其它失败
 	     *
		 */
	    virtual uint32_t ModifyBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::CBranchDdo& branch,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	    	) = 0;
	};

	///异步调用接口
	class IOrganizationDaoAsyc
	{
	public:
		virtual ~IOrganizationDaoAsyc() {}
	public:
		virtual uint32_t SendDeleteBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve
				) = 0;
		virtual uint32_t RecvDeleteBranch(
				const CCntlInfo& rCntlInfo,

				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::string& outReserve
				) = 0;
		virtual uint32_t SendFindBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::COrganizationFilterDdo& filter,
				const std::string& inReserve
				) = 0;
		virtual uint32_t RecvFindBranch(
				const CCntlInfo& rCntlInfo,

				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
				) = 0;
		virtual uint32_t SendGetBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& branchId,
				const std::string& inReserve
				) = 0;
		virtual uint32_t RecvGetBranch(
				const CCntlInfo& rCntlInfo,

				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::organization::ddo::CBranchDdo >& branch,
				std::string& outReserve
				) = 0;
		virtual uint32_t SendModifyBranch(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::organization::ddo::CBranchDdo& branch,
				const std::string& inReserve
				) = 0;
		virtual uint32_t RecvModifyBranch(
				const CCntlInfo& rCntlInfo,

				std::string& errmsg,
				std::string& outReserve
				) = 0;
	};
	
	
}
}
}

#endif /*ORGANIZATIONDAO_INTERFACE_H*/
